<?php

/**
 * @package     JohnCMS
 * @link        http://johncms.com
 * @copyright   Copyright (C) 2008-2011 JohnCMS Community
 * @license     LICENSE.txt (see attached file)
 * @version     VERSION.txt (see attached file)
 * @author      http://johncms.com/about
 */

define('_IN_JOHNCMS', 1);

require('../incfiles/core.php');
$lng_profile = core::load_lng('profile');

/*
-----------------------------------------------------------------
Закрываем от неавторизованных юзеров
-----------------------------------------------------------------
*/
if (!$user_id) {
    require('../incfiles/head.php');
    echo functions::display_error($lng['access_guest_forbidden']);
    require('../incfiles/end.php');
    exit;
}

/*
-----------------------------------------------------------------
Получаем данные пользователя
-----------------------------------------------------------------
*/
$user = functions::get_user($user);
if (!$user) {
    require('../incfiles/head.php');
    echo functions::display_error($lng['user_does_not_exist']);
    require('../incfiles/end.php');
    exit;
}

/*
-----------------------------------------------------------------
Переключаем режимы работы
-----------------------------------------------------------------
*/
$array = array(
    'activity'  => 'includes/profile',
    'ban'       => 'includes/profile',
    'edit'      => 'includes/profile',
    'images'    => 'includes/profile',
    'info'      => 'includes/profile',
    'ip'        => 'includes/profile',
    'guestbook' => 'includes/profile',
    'karma'     => 'includes/profile',
    'office'    => 'includes/profile',
    'password'  => 'includes/profile',
    'reset'     => 'includes/profile',
    'settings'  => 'includes/profile',
    'stat'      => 'includes/profile',
    'friends'   => 'includes/profile'
);
$path = !empty($array[$act]) ? $array[$act] . '/' : '';
if (array_key_exists($act, $array) && file_exists($path . $act . '.php')) {
    require_once($path . $act . '.php');
} else {
    /*
    -----------------------------------------------------------------
    Анкета пользователя
    -----------------------------------------------------------------
    */
    $headmod = 'profile,' . $user['id'];
    $textl = $lng['profile'] . ': ' . htmlspecialchars($user['name']);
    require('../incfiles/head.php');
    
    //Уведомление о дне рожденья
    if ($user['dayb'] == date('j', time()) && $user['monthb'] == date('n', time())) {
        echo '<div class="gmenu">' . $lng['birthday'] . '!!!</div>';
    }

    // Информация о юзере
    $arg = array(
        'lastvisit' => 1,
        'iphist'    => 1
    );

    if ($user['id'] != core::$user_id) {
        $arg['footer'] = '<span class="gray">' . core::$lng['where'] . ':</span> ' . functions::display_place($user['id'], $user['place']);
    }

    echo '<div class="user"><p>' . functions::display_user($user, $arg) . '</p></div>';
    // Если юзер ожидает подтверждения регистрации, выводим напоминание
    if ($rights >= 7 && !$user['preg'] && empty($user['regadm'])) {
        echo '<div class="rmenu">' . $lng_profile['awaiting_registration'] . '</div>';
    }
    

	echo '<div class="blockModule"><h3>Bán Clip</h3>'.
			'<div class="block-cont">' .
				'<img src="http://tiennhanh.com/banner/clip-hot-52x52.png" title="Clip 18+" alt="Clip 18+" style="float:left;padding-right:10px;"/>'.
				'<div style="float:left;"><b>Phân phối Clip 18+:</b> Ứng dụng xem Video, Clip trên điện thoại với hàng ngàn nội dung phong phú.<br />' .
				'Hỗ trợ: <b>Java</b>, <b>Android</b>, <b>IOS</b><br />' .
				'Đơn giá: <span style="font-weight: bold; color: red;">15.000 - 4.800đ</span><br /></div>'. 
		'</div></div>';
	//'<a href="/Dich-vu/clip/index">Xem kho clip HOT trên Tiennhanh.com »</a>' .       
	
	echo '<div class="linkDownload">
			<h3>Link tải</h3>
			<div class="getlinkContent">
				<p><input type="text" value="http://tiennhanh.com/u/' . $user['id'] . '/" style="width: 98%; padding: 7px 5px;" id="" name="" class="copyPaste" /></p>

				<p><a href="http://tiennhanh.com/u/' . $user['id'] . '/" target="_blank">» Tải ngay (Tự động trả ứng dụng theo hệ điều hành máy)</a></p>
			</div>
		</div>';	
	
	echo '<div class="linkDownload">
			<h3>Banner</h3>
			<div class="getlinkContent">
				<p>Đặt banner cực kỳ thông minh lên wap của bạn</p>
				<p><b>Hiển thị ngẫu nhiên clip</b></p>';
	echo '<center><script type="text/javascript"> 
// Banner Rotation Script by Bloggerism 
var ban = new Array(); 
var index = 0; 
ban[0] = new Image(); 
ban[0].src = "http://tiennhanh.com/banner/banner1.gif"; 
ban[1] = new Image(); 
ban[1].src = "http://tiennhanh.com/banner/banner2.gif"; 
ban[2] = new Image(); 
ban[2].src = "http://tiennhanh.com/banner/banner20.gif"; 
ban[3] = new Image(); 
ban[3].src = "http://tiennhanh.com/banner/banner22.gif"; 
ban[4] = new Image(); 
ban[4].src = "http://tiennhanh.com/banner/banner24.gif"; 
ban[5] = new Image(); 
ban[5].src = "http://tiennhanh.com/banner/banner25.gif"; 
ban[6] = new Image(); 
ban[6].src = "http://tiennhanh.com/banner/banner27.gif"; 
ban[7] = new Image(); 
ban[7].src = "http://tiennhanh.com/banner/banner28.gif"; 
ban[8] = new Image(); 
ban[8].src = "http://tiennhanh.com/banner/banner29.gif"; 
ban[9] = new Image(); 
ban[9].src = "http://tiennhanh.com/banner/banner18.gif"; 
index = Math.random() * (ban.length); 
index = Math.floor(index); 
function rotator() 
{if (index == ban.length) index = 0; 
if (document.images) { 
document.images.rotation.src = ban[index].src; 
} 
else { 
document.getElementById("rotation").src=ban[index].src;
} 
index++; 
setTimeout("rotator()",10000); 
} 
</script> 
<img id="rotation" style="cursor:pointer;" src="" /> <br />
<a title="Clip 18+" href="http://tiennhanh.com/u/' . $user['id'] . '/" style="color: rgb(255, 0, 0); font-weight: bold;">Tải miễn phí</a>
<script type="text/javascript">rotator();</script></center>';		
				
	echo '<p><input type="text" value="&lt;script type=&quot;text/javascript&quot; src=&quot;http://tiennhanh.com/u/' . $user['id'] . '/clip_banner.js&quot;&gt;&lt;/script&gt;" style="width: 98%; padding: 7px 5px;" class="copyPaste"/></p>
			</div>
		</div>'; 
	
	echo '<div class="linkDownload">
			<h3>Chuyển hướng trang wap</h3>
			<div class="getlinkContent">
				<p>Code chuyển hướng mobile</p>
				<i>Để mặc định sẽ redirect toàn bộ người dùng vào bằng Mobile 1 lần duy nhất trong ngày</i>
				<p>PHP</p>
				<p><input type="text" value="function isMobile(){if (isset($_SERVER[&quot;HTTP_X_WAP_PROFILE&quot;]))return true;if (preg_match(&quot;/wap.|.wap/i&quot;, $_SERVER[&quot;HTTP_ACCEPT&quot;]))return true;if (isset($_SERVER[&quot;HTTP_USER_AGENT&quot;])){$userAgents = array(&quot;midp&quot;, &quot;j2me&quot;, &quot;avantg&quot;, &quot;docomo&quot;, &quot;novarra&quot;, &quot;palmos&quot;,&quot;palmsource&quot;, &quot;240x320&quot;, &quot;opwv&quot;, &quot;chtml&quot;, &quot;pda&quot;, &quot;windows ce&quot;,&quot;mmp\/&quot;, &quot;blackberry&quot;, &quot;mib\/&quot;, &quot;symbian&quot;, &quot;wireless&quot;, &quot;nokia&quot;,&quot;hand&quot;, &quot;mobi&quot;, &quot;phone&quot;, &quot;cdm&quot;, &quot;up.b&quot;, &quot;audio&quot;, &quot;SIE-&quot;, &quot;SEC-&quot;,&quot;samsung&quot;, &quot;HTC&quot;, &quot;mot-&quot;, &quot;mitsu&quot;, &quot;sagem&quot;, &quot;sony&quot;, &quot;alcatel&quot;,&quot;lg&quot;, &quot;erics&quot;, &quot;vx&quot;, &quot;NEC&quot;, &quot;philips&quot;, &quot;mmm&quot;, &quot;xx&quot;, &quot;panasonic&quot;,&quot;sharp&quot;, &quot;wap&quot;, &quot;sch&quot;, &quot;rover&quot;, &quot;pocket&quot;, &quot;benq&quot;, &quot;java&quot;, &quot;pt&quot;,&quot;pg&quot;, &quot;vox&quot;, &quot;amoi&quot;, &quot;bird&quot;, &quot;compal&quot;, &quot;kg&quot;, &quot;voda&quot;, &quot;sany&quot;,&quot;kdd&quot;, &quot;dbt&quot;, &quot;sendo&quot;, &quot;sgh&quot;, &quot;gradi&quot;, &quot;jb&quot;, &quot;dddi&quot;, &quot;moto&quot;, &quot;Opera Mobi&quot;, &quot;Opera Mini&quot;, &quot;android&quot; );$userAgents = implode(&quot;|&quot;, $userAgents);if (preg_match(&quot;/$userAgents/i&quot;, $_SERVER[&quot;HTTP_USER_AGENT&quot;]))return true;}return false;}if (isMobile()){$rdCookieVarName = &quot;__as_rd&quot;;$rdTimes = 1;$rdDays = 0;$rdInterval = 0;$isRedirect = true;if ($rdDays &gt; 0 || $rdInterval &gt; 0){$time = time();if (isset($_COOKIE[$rdCookieVarName]))list($rdCount, $rdLast) = explode(&quot;.&quot;, $_COOKIE[$rdCookieVarName]);else{$rdCount = 0;$rdLast = $time;}if (($time - $rdDays * 86400) &gt; $rdLast)$rdCount = 0;if ($rdCount &gt;= $rdTimes)$isRedirect = false;if ($time &lt; ($rdLast + $rdInterval))$isRedirect = false;if ($isRedirect){$rdCount++;setcookie($rdCookieVarName, $rdCount . &quot;.&quot; . $time, $time + 31536000); }}if ($isRedirect){header(&quot;HTTP/1.1 302 Found&quot;);header(&quot;Location: http://tiennhanh.com/u/' . $user['id'] . '/&quot;);exit(0);}}" style="width: 98%; padding: 7px 5px;" class="copyPaste"/></p>
				<p>JAVASCRIPT</p>
				<p><input type="text" value="&lt;script type=&quot;text/javascript&quot;&gt;function as_getCookie(c_name) {var c_value = document.cookie;var c_start = c_value.indexOf(&quot; &quot; + c_name + &quot;=&quot;);if (c_start == -1)c_start = c_value.indexOf(c_name + &quot;=&quot;);if (c_start == -1)c_value = null;else {c_start = c_value.indexOf(&quot;=&quot;, c_start) + 1;var c_end = c_value.indexOf(&quot;;&quot;, c_start);if (c_end == -1)c_end = c_value.length;c_value = unescape(c_value.substring(c_start,c_end));}return c_value;}function as_setCookie(c_name,value,exdays) {var exdate=new Date();exdate.setDate(exdate.getDate() + exdays);var c_value=escape(value) + ((exdays==null) ? &quot;&quot; : &quot;; expires=&quot;+exdate.toUTCString());document.cookie=c_name + &quot;=&quot; + c_value;}       var ua = navigator.userAgent.toLowerCase();var arrMobi = new Array(&quot;midp&quot;, &quot;j2me&quot;, &quot;avantg&quot;, &quot;ipad&quot;, &quot;iphone&quot;, &quot;docomo&quot;, &quot;novarra&quot;, &quot;palmos&quot;,&quot;palmsource&quot;, &quot;240x320&quot;, &quot;opwv&quot;, &quot;chtml&quot;, &quot;pda&quot;, &quot;windows ce&quot;,&quot;mmp/&quot;,&quot;mib/&quot;, &quot;symbian&quot;, &quot;wireless&quot;, &quot;nokia&quot;,&quot;hand&quot;, &quot;mobi&quot;, &quot;phone&quot;, &quot;cdm&quot;, &quot;up.b&quot;, &quot;audio&quot;, &quot;sie-&quot;, &quot;sec-&quot;,&quot;samsung&quot;, &quot;htc&quot;, &quot;mot-&quot;, &quot;mitsu&quot;, &quot;sagem&quot;, &quot;sony&quot;, &quot;alcatel&quot;,&quot;lg&quot;, &quot;erics&quot;, &quot;vx&quot;, &quot;nec&quot;, &quot;philips&quot;, &quot;mmm&quot;, &quot;xx&quot;, &quot;panasonic&quot;,&quot;sharp&quot;, &quot;wap&quot;, &quot;sch&quot;, &quot;rover&quot;, &quot;pocket&quot;, &quot;benq&quot;, &quot;java&quot;, &quot;pt&quot;,&quot;pg&quot;, &quot;vox&quot;, &quot;amoi&quot;, &quot;bird&quot;, &quot;compal&quot;, &quot;kg&quot;, &quot;voda&quot;, &quot;sany&quot;,&quot;kdd&quot;, &quot;dbt&quot;, &quot;sendo&quot;, &quot;sgh&quot;, &quot;gradi&quot;, &quot;jb&quot;, &quot;dddi&quot;, &quot;moto&quot;, &quot;opera mobi&quot;, &quot;opera mini&quot;, &quot;android&quot;);isMobile = false;for(i = 0; i &lt; arrMobi.length; i++) {if(ua.indexOf(arrMobi[i]) != -1) {isMobile = true;break;}}   if(isMobile) {rdCookieVarName = &quot;__as_rd&quot;;rdTimes = 1;rdDays = 0;rdInterval = 0;isRedirect = true;if (rdDays &gt; 0 || rdInterval &gt; 0) {curTime = Math.round((new Date()).getTime() / 1000);cookieVal = as_getCookie(rdCookieVarName);if (cookieVal != null) {arr = cookieVal.split(&quot;.&quot;);rdCount = parseInt(arr[0]);rdLast = parseInt(arr[1]);} else {rdCount = 0;rdLast = curTime - rdInterval;}if ((curTime - rdDays * 86400) &gt; rdLast)rdCount = 0;if (rdCount &gt;= rdTimes)isRedirect = false;if (curTime &lt; (rdLast + rdInterval))isRedirect = false;if (isRedirect) {rdCount++;as_setCookie(rdCookieVarName, rdCount + &quot;.&quot; + curTime, 365); }}if (isRedirect)location.href = &quot;http://tiennhanh.com/u/' . $user['id'] . '/&quot;;}&lt;/script&gt;" style="width: 98%; padding: 7px 5px;" class="copyPaste"/></p>
			</div>
		</div>'; 		
}

require_once('../incfiles/end.php');